#include <iostream>
using namespace std;


int main()
{
	int n, m;
	int a[110][110];
	float b[110][110];
	cin >> n >> m;
	int i = 0;
	int j = 0;
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < m; j++)
		{
			cin >> a[i][j];
			b[i][j] = a[i][j];
		}	
	}
	
	for(i = 1; i < n - 1; i++)
	{
		for(j = 1; j < m - 1; j++)
		{
			b[i][j] = (a[i][j] + a[i-1][j] + a[i+1][j] + a[i][j-1] + a[i][j+1]) / 5.0 + 0.5;
		}
	}
	
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < m; j++)
			cout << b[i][j] << " ";
		puts("");
	}
	return 0;
}
